home *** CD-ROM | disk | FTP | other *** search
- //-----------------------------------------
- // HollowFont.cs ⌐ 2001 by Charles Petzold
- //-----------------------------------------
- using System;
- using System.Drawing;
- using System.Drawing.Drawing2D;
- using System.Windows.Forms;
-
- class HollowFont: FontMenuForm
- {
- public new static void Main()
- {
- Application.Run(new HollowFont());
- }
- public HollowFont()
- {
- Text = "Fuente hueca";
- Width *= 2;
- strText = "Hueca";
- font = new Font("Times New Roman", 108);
- }
- protected override void DoPage(Graphics grfx, Color clr, int cx, int cy)
- {
- GraphicsPath path = new GraphicsPath();
- float fFontSize = PointsToPageUnits(grfx, font);
-
- // Obtener coordenadas para una fuente centrada.
-
- SizeF sizef = grfx.MeasureString(strText, font);
- PointF ptf = new PointF((cx - sizef.Width) / 2,
- (cy - sizef.Height) / 2);
-
- // A±adir texto al trazado.
-
- path.AddString(strText, font.FontFamily, (int) font.Style,
- fFontSize, ptf, new StringFormat());
-
- // Dibujar el trazado.
-
- grfx.DrawPath(new Pen(clr), path);
- }
- }